import {v4 as uuidv4} from 'uuid';
// 生成一个不发生改变的随机字符串，存储于localStorage中
export const getUUID = ()=>{
    // 先判断本地存储中是否有UUID
    let uuid = localStorage.getItem("UUIDTOKEN")//有的话直接赋值
    if(!uuid){//没有的情况
    // 生成临时身份并存入本地存储中
      uuid = uuidv4()
      localStorage.setItem("UUIDTOKEN",uuid)
    }
    return uuid
}